﻿using ARchGL.Platform.WindowsService.Application;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LED.Debug
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();

            //numericUpDown1.Value = 96;
        }

        private LEDService led = new LEDService();

        private void btnSendArea_Click(object sender, EventArgs e)
        {
            var width = int.Parse(numericUpDown1.Value.ToString());
            var height = int.Parse(numericUpDown2.Value.ToString());

            lblMessage.Text = "区域" + (led.SendArea(width, height) ? "发送成功" : "发送失败");
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            led.ScreenClear();
        }

        private void btnSendContent_Click(object sender, EventArgs e)
        {
            var x = int.Parse(textBox1.Text.Trim());
            var y = int.Parse(textBox2.Text.Trim());
            var fontSize = int.Parse(txtFontSize.Text); 
            var width = int.Parse(numericUpDown1.Value.ToString());
            var height = int.Parse(numericUpDown2.Value.ToString());

            lblMessage.Text = "文字" + (led.SendContent(x, y, fontSize, width, height, richTextBox1.Text) ? "发送成功" : "发送失败");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var x = int.Parse(textBox1.Text.ToString());
            var y = int.Parse(textBox2.Text.ToString());
            var width = int.Parse(numericUpDown1.Value.ToString());
            var height = int.Parse(numericUpDown2.Value.ToString());

            lblMessage.Text = "图片";// +  "发送成功" : "发送失败";
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            var bitmap = led.SendBitmap(x, y, width, height, richTextBox1.Text);

        }
    }
}
